<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="com.model.GameModel"%>
<%@page import="com.dao.GameDao"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
%>
<html>
	<head>
		<title>Tec Games - Pagina Teste</title>
		<link rel="stylesheet" type="text/css" href="../resources/css/default.css" />
		<link rel="shortcut icon" href="<%=request.getContextPath()%>/favicon.ico" type="image/x-icon" />
		<style>
			#imagem{
				width:101px;				
				display:block;
				margin-right:auto;
				margin-left:auto;
			}		
			p{
				text-align:center;
			}
		</style>
	</head>
	<body>
		<div id="container">
			<jsp:include page="../resources/header.jsp"/>
			<div id="content">
				<%
					GameDao gameDao = new GameDao();
					List<GameModel> gameModels = new ArrayList<GameModel>();
				%>
				<form method="get" action="<%=request.getContextPath()%>/servico/detalheGame.jsp"  enctype="multipart/form-data">
					<table cellspacing="10" style="width:100%;">
						<tbody>
							<%
								gameModels = gameDao.getGames();
								int col = 0;
								out.print("<tr>");
								for(GameModel game:gameModels){
									if(col==5){
										out.print("<tr>");
										col=0;
									}
									out.print("\n<td>");
									//out.print("\n\t <p>ID "+game.getId()+"</p>");
									out.print("\n\t<input id=\"imagem\" type=\"image\" width=\"100\" height=\"100px\" value=\""+game.getId()+"\" name=\"codGame\" src=\""+request.getContextPath()+game.getUrl()+"\" alt=\""+game.getTitulo()+"\"/>");
									out.print("\n\t<p>"+game.getTitulo()+"</p>");
									out.print("\n</td>");
									col++;
								}
								out.print("</tr>");
							%>
						</tbody>
					</table>
				</form>
			</div>
		</div>
	</body>
</html>
